#include <normalWindow.h>

#include <iostream>

namespace lgb_gtk
{

  NormalWindow::NormalWindow()
  {
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(GTK_OBJECT(window),"delete_event",
		     G_CALLBACK(WhenCloseWindow), this );
    canvasWidget = goo_canvas_new();
    gtk_container_add((GtkContainer *)window, canvasWidget);
    canvasForChild = goo_canvas_get_root_item((GooCanvas *)canvasWidget);
  }

  NormalWindow::~NormalWindow()
  {

  }

  int NormalWindow::Show()
  {
    gtk_widget_set_size_request(window , width , height);
    gtk_widget_show_all(window);
    return 0;
  }

  int NormalWindow::Hide()
  {
    gtk_widget_hide_all(window);

    return 0;
  }

  int NormalWindow::SetTitle(string title)
  {
    gtk_window_set_title((GtkWindow*)window , title.c_str());
    return 0;
  }

  gboolean WhenCloseWindow(GtkWidget *widget,
			   GdkEvent  *event,
			   gpointer   user_data)
  {
    NormalWindow *w = (NormalWindow*)user_data;
    w->CloseFunctionsBase();
    return true;
  }

}
